﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.Utils;

namespace WCS.Entity
{
    [SugarTable("WCS_SendPLCCode")]
    public class SendPLCCode
    {
        public string taskCode { get; set; }
        public string barCode { get; set; }
        public string wareHourseCode { get; set; }
        public string task_type { get; set; }
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 数据库连接对象
        /// </summary>
        static SqlSugarDapper _SqlSugarDapper = SqlSugarDapper.GetDbContext();

        public static void AddSendPLCInfo(SendPLCCode sendPLCCode)
        {
            _SqlSugarDapper.DB.Insertable(sendPLCCode).ExecuteCommand();
            DeleteSendPLCInfo();
        }

        /// <summary>
        /// 删除10天前的记录
        /// </summary>
        /// <param name="warehouseIO"></param>
        public static void DeleteSendPLCInfo()
        {
            _SqlSugarDapper.DB.Deleteable<SendPLCCode>().Where(w => w.CreateTime < DateTime.Now.AddDays(-7)).ExecuteCommand();
        }
    }
}
